from abc import ABC, abstractmethod


class BaseProHandler(ABC):
    @abstractmethod
    def write(self, command: str):
        """写入一行命令"""
        pass

    @abstractmethod
    def readline(self) -> str:
        """读取一行命令"""
        pass

    @abstractmethod
    def poll(self) -> int | None:
        """运行时返回None结束时返回退出码"""
        pass

    @abstractmethod
    def terminate(self):
        """结束进程"""
        pass

    @abstractmethod
    def kill(self):
        """强行结束进程"""
        pass

    @abstractmethod
    def wait(self, wait_time: float = None) -> int | None:
        """等待程序运行"""
        pass
